/*
 * device.h
 *
 *  Created on: Jun 24, 2013
 *      Author: r.leonov
 */

#ifndef DEVICE_H_
#define DEVICE_H_

#include "kl_lib_l15x.h"

#define STARTSLEEP_COUNT    21
#define TIME_OF_SIL         29970 // 119880 - 2 min

enum TreeState_t { tsActive, tsSleep, tsWakeup, tsSuspend };



class Device_t {
private:
    uint8_t Count;
    uint32_t Timer;
    bool SensorActive() { return(GPIOA->IDR & GPIO_Pin_0); }
public:
    TreeState_t State;
    void Task(void);
    void Init(void);

    // Service
//    void SetSleepTime(uint32_t ASleepTime);
};

extern Device_t Tree;

#endif /* DEVICE_H_ */
